import { request } from './reuqest'
export function getGoods() {
  return request({
    url: 'categories',
    method: 'get',
    params: {
      type: 3
    }
  })
}
export function getParamsId(query) {
  return request({
    url: `categories/${query.id * 1}/attributes`,
    method: 'get',
    params: {
      sel: query.sel
    }
  })
}
// 点击添加确定 获取数据
export function getAddParams(query, form) {
  return request({
    url: `categories/${query.id * 1}/attributes`,
    method: 'post',
    data: {
      attr_sel: query.sel,
      attr_name: form.attr_name
    }
  })
}
// 点击修改按钮  根据Id查询当前数据
export function getEditParams(query, form, attrId) {
  return request({
    url: `categories/${query.id * 1}/attributes/${attrId}`,
    method: 'get',
    params: {
      attr_sel: query.sel
    }
  })
}
// 点击修改中确定按钮修改请求
export function getEdit(query) {
  return request({
    url: `categories/${query.cat_id}/attributes/${query.attr_id * 1}`,
    method: 'put',
    data: {
      attr_sel: query.attr_sel,
      attr_name: query.attr_name
    }
  })
}
// 删除属性
export function getDeleteParams(query, attrId) {
  return request({
    url: `categories/${query.id}/attributes/${attrId}`,
    method: 'delete'
  })
}
